﻿
using System;
using System.Collections.Generic;
 
using CarTrackr.Data.Attributes;
using CarTrackr.Data;

using System.Web.Security;

namespace CarTrackr.Business
{
    public class User :BusinessBase
    {
        public List<Car> Cars;

        [DbField(Name = "UserId")]
        public Guid UserId { get; set; }


        [DbField(Name = "UserName")]
        public string UserName { get; set;}

        [DbField(Name = "Email")]
        public string Email { get; set; }

        [DbField(Name = "Password")]
        public string Password { get; set; }



        [DbField(Name = "IsOnline")]
        public bool IsOnline { get; set; }


        public string OnlineStatus
        {
            get
            {
                return IsOnline ? "Online" : "Offline"; 
            }
        }

        public User()
        {
            Cars = new List<Car>();


        }

        public void AddCar(Car car)
        {
            Cars.Add(car);
        }

        public static  User  GetFromMembershipUser(MembershipUser member)
        {
           return  Converter.ToBusinessBase<User>(member);

           
        }

    }
}
